package controllers;

import java.util.*;


import javax.servlet.http.HttpServletRequest;


import play.*;
import play.cache.Cache;
import play.data.validation.Required;
import play.libs.Images;
import play.mvc.*;

import models.*;

@With(Secure.class) 
public class Application extends Controller {   
	
	@Before
	static void setConnectedUser() {
		if(Security.isConnected()) {
			Agent agent = Agent.find("byEmail", Security.connected()).first();
			renderArgs.put("agent_email", agent.email);
			renderArgs.put("agent_fullname", agent.fullname());
			renderArgs.put("agent_responsable", agent.getCisService().isResponsable(agent));
			renderArgs.put("agent_orga", !agent.isOrgaStage(agent));
			if(agent.niv.id != 0){
				renderArgs.put("agent_for", agent.niv);
			}
			renderArgs.put("agent_respPedago", SystemSDIS.getSystemSDIS().isResponsableDepartemental(agent));
		}
	}
	
	public static void index() {
        render("@Stages.listStages");
    }
} 